﻿Public Partial Class Login
    Inherits System.Web.UI.Page
    Dim _db As New hc_databaseDataContext
    Dim _var As Mitgliede_Anwaerter

    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load

    End Sub

    



    Protected Sub btn_login_Click(ByVal sender As Object, ByVal e As EventArgs) Handles btn_login.Click


        Try
            Dim _var = (From it In _db.Mitgliede_Anwaerter _
                      Where it.Benutzername = txt_benutzername.Text _
                      And it.Passwort = txt_kennwort.Text _
                      Select it).Single
            Session("user") = _var
            Session("username") = _var.Benutzername
            Session("userid") = _var.ID
            lbl_fehlermeldung.Text = ""
            Session("Rang") = _var.Mitgliedsstatus
            Select Case _var.Mitgliedsstatus
                Case "Vorstand"
                    Session("rangid") = 1
                Case "PM"
                    Session("rangid") = 2
                Case "Mitglied"
                    Session("rangid") = 3
                Case "Anwärter"
                    Session("rangid") = 3
                Case "JPM"
                    Session("rangid") = 2
                Case "Ressortleiter-QM"
                    Session("rangid") = 4
            End Select

            Dim _var2 As Array = (From it In _db.Arbeitet_ans _
                       Where it.Mitgliede_AnwaerterID = _var.ID _
                       Select it.ProjektID, it.rolle).ToArray
            Dim var5 = (From it In _db.Arbeitet_ans _
                        Where it.Mitgliede_AnwaerterID = _var.ID _
                      Distinct Select it.ProjektID).ToList
            Session("Projekte_maud") = var5

            Response.Redirect("projekt_uebersicht_extern.aspx")
            Dim bla = _var2(3)

        Catch ex As Exception
            lbl_fehlermeldung.Text = "Benutzername oder Passwort falsch!"

        End Try

        




    End Sub
End Class